﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ChinaDynastyTours.Controls;
using ChinaDynastyTours.Models;
using ChinaDynastyTours.Helpers;

namespace ChinaDynastyTours.Views
{
    public partial class TravelSelectedToolForm : DevExpress.XtraEditors.XtraForm
    {
        //输入参数
        public string _TourGroupID { get; set; }//团ID
        public string _TourGroupState { get; set; }//团状态
        public int _TourGroupScheduleID { get; set; }//行程计划ID

        public int _ExpenseID { get; set; }//费用ID,用于判定当前选定的行程计划是否存在宾馆预定及费用信息
        
        //输出参数
        //输出参数
        public string ReturnTravelAgencyID { get; set; }
        public string ReturnTravelAgencyName { get; set; }
        public string ReturnContact { get; set; }

        public TravelSelectedToolForm()
        {
            InitializeComponent();
        }
        private void LoadData()
        {
            travelAgencyGridControl.DataSource = BaseInfoCtrl.GetProviderData(new ProviderTypeEnum[] { ProviderTypeEnum.旅行社 }, CN2PYHelper.CapitalCovert(tbCityName.Text), CN2PYHelper.CapitalCovert(tbProviderName.Text));
        }

        private void TravelOrderForm_Load(object sender, EventArgs e)
        {
            //初始化旅行社数据
            //travelAgencyGridControl.DataSource = BaseInfoCtrl.GetProviderData(new ProviderTypeEnum[] { ProviderTypeEnum.旅行社 });
            LoadData();

            lblTourGroupState.Text = _TourGroupState;
            lblTourGroupID.Text = _TourGroupID;
        }

        //private void travelAgencyGridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        //{
        //    if (e.Clicks == 1)
        //    {
        //        string providerId = travelAgencyGridView.GetDataRow(travelAgencyGridView.FocusedRowHandle)["ProviderID"].ToString();
        //        travelServiceGridControl.DataSource = ServiceInfoCtrl.GetTravelAgentServiceData(providerId);
        //    }
        //}

        private void btnOk_Click(object sender, EventArgs e)
        {
            string providerName = 

            //返回行程计划显示信息
            ReturnTravelAgencyName = travelAgencyGridView.GetDataRow(travelAgencyGridView.FocusedRowHandle)["ProviderName"].ToString();
            ReturnTravelAgencyID = travelAgencyGridView.GetDataRow(travelAgencyGridView.FocusedRowHandle)["ProviderID"].ToString();
            ReturnContact = travelAgencyGridView.GetDataRow(travelAgencyGridView.FocusedRowHandle)["Contact"].ToString();
        }
        private void TextBox_TextChanged(object sender, EventArgs e)
        {
            LoadData();
        }

    }
}
